package com.cz.video.website.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cz.video.common.annotation.LegalContent;
import com.cz.video.common.core.domain.BaseEntity;
import com.cz.video.common.xss.Xss;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * <p>
 * 用户账户表
 * </p>
 *
 * @author 游蓉
 * @since 2023-10-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("website_account")
@Schema( description="用户账户表")
public class WebsiteAccount extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "account_id")
    private Long accountId;

    @Schema(description = "用户名")
    @Length(max = 30,message = "用户名长度不能超过{max}个字符")
    @LegalContent
    private String username;

    @Pattern(regexp = "^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[@#$%^&+=])(?=.{1,100}$).+$", message = "密码不规范")
    @Schema( description = "用户密码")
    private String password;

    @LegalContent
    @Xss(message = "不可以使用脚本文件")
    @Schema( description = "账户描述")
    @Length(max = 30,message = "账户描述长度不能超过{max}个字符")
    private String accountDesc;

    @Schema( description = "用户的昵称")
    @NotBlank(message = "用户昵称不能为空")
    @LegalContent
    @Length(max = 13,message = "昵称长度不能超过{max}个字符")
    private String nickname;

    @Schema( description = "用户的头像地址")
    private String avatar;

    @Email(message = "邮箱格式不正确")
    @Schema( description = "用户的邮箱地址")
    private String email;

    @LegalContent
    @Schema( description = "是否允许评论")
    @TableField("is_allow_comment")
    @Size(max = 500, message = "评论内容不能超过{max}个字符")
    private Boolean allowComment;

    @Schema( description = "状态,0：正常，1：禁用")
    private String status;

    @TableLogic
    @Schema( description = "删除标志")
    private Integer delFlag;
}
